<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Convert Currency</title>
    </h:head>
    <h:body>
        <h:form>
            <h:outputLabel for="valueInCurrency" rendered="#{currencyManager.conversionDone == true}"  value="Converted: "/>
                <h:outputText id="valueInCurrency" rendered="#{currencyManager.conversionDone == true}" value="#{currencyManager.valueInCurrency}"/>
            <h3>Convert</h3>
            <p>
                <h:outputLabel for="convertFrom" value="Convert from: "/>
                <h:selectOneMenu id="convertFrom" value="#{currencyManager.convertFrom}">
                    <f:selectItems value="#{currencyManager.currencies}" />
                </h:selectOneMenu>
            </p>
            
            <p>
                <h:outputLabel for="convertTo" value="Convert to: "/>
                <h:selectOneMenu id="convertTo" value="#{currencyManager.convertTo}">
                    <f:selectItems value="#{currencyManager.currencies}" />
                </h:selectOneMenu>
            </p>

            <p>
                <h:outputLabel for="amount" value="Amount"/>
                <h:inputText id="amount" value="#{currencyManager.amountToConvert}"/>
            </p>
          
            <p>
                <h:commandButton value="Convert" action="#{currencyManager.convert}"/>
            </p>
            <hr/>
            
            <h3>New Currency</h3>
            <p>
                <h:outputLabel for="newCurrencyName" value="Name the new currency: "/>
                <h:inputText id="newCurrencyName" value="#{currencyManager.newCurrencyName}"/>
            </p>
            <p>
                <h:outputLabel for="newCurrencyExchangeRate" value="Exchange rate: "/>
                <h:inputText id="newCurrencyExchangeRate" value="#{currencyManager.newCurrencyExchangeRate}"/>
            </p>
            
            <p>
                <h:commandButton value="New Currency" action="#{currencyManager.newCurrency()}"/>
            </p>
        </h:form>
    </h:body>
</html>

